cbuffer cbPerObject{
	matrix mtxWorld : World;
	matrix mtxWorldVP : WorldViewProjection;
	float3 light1 : LightDir;
};

cbuffer cbPerFrame{

};
float3 ambientlight={.3,.3,.3};

struct VS_INPUT{
	float3 iPosL : POSITION;
	float3 iNormal : NORMAL;
	float4 iColor : COLOR;
};
struct VS_OUTPUT{
	float4 oPosH : SV_POSITION;
	float4 oColor : COLOR;
	float3 oNormal : NORMAL;
};

VS_OUTPUT VS(VS_INPUT input){
	VS_OUTPUT output;

	// Transforming as normal
	float4 mtx4_tvec4 = mul ( float4(input.iNormal,0.0f) , mtxWorld );
	float3 mtx4_tvec3 = mtx4_tvec4.xyz;
	float3 normalize1 = normalize( mtx4_tvec3 );

	// Transforming as position
	float4 mtx1_tvec4 = mul ( float4(input.iPosL,1.0f) , mtxWorldVP );

	output.oPosH=mtx1_tvec4;
	output.oColor=input.iColor;
	output.oNormal=normalize1;
	return output;
}

struct PS_INPUT{
	float4 posH : SV_POSITION;
	float4 color : COLOR;
	float3 normal : NORMAL;
};

struct PS_OUTPUT{
	float4 color0 : SV_TARGET;
};

PS_OUTPUT PS(PS_INPUT input){
	PS_OUTPUT output;
	float3 convert1_xyz = input.color.xyz;
	float convert1_w = input.color.w;


	float dot1 =   dot( input.normal, light1 );
	float3 product1 = convert1_xyz * dot1 + ambientlight;

	float4 v2c1 = float4( product1 , convert1_w );
	output.color0=v2c1;
	return output;
}

// dit is specifiek voor DirectX10
technique10 basicshader
{
	pass one
	{
		SetVertexShader( CompileShader ( vs_4_0, VS() ));
		SetGeometryShader( NULL );
		SetPixelShader( CompileShader ( ps_4_0, PS() ));

	}
}